package com.hospital.demo.service.impl.jiashuai;

import com.hospital.demo.mapper.jiashuai.ITWorkerDao;
import com.hospital.demo.model.jiashuai.TWorker;
import com.hospital.demo.service.jiashuai.ITWorkerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class TWorkerServiceImpl implements ITWorkerService {

    @Autowired
    private ITWorkerDao itWorkerDao;

    @Override
    public List<TWorker> selectTWorker() {
        return itWorkerDao.selectTWorker();
    }

    @Override
    public List<TWorker> selectTWorkerByDepartment(int did) {
        return itWorkerDao.selectTWorkerByDid(did);
    }

    @Override
    public List<TWorker> selectTWorkerByid(int id) {
        return itWorkerDao.selectTWorkerByid(id);
    }

    @Override
    public int resignid(int id) {
        return itWorkerDao.updateState(id);
    }

    @Override
    public int addTworker(TWorker tWorker) {
        tWorker.setTrole("在职");
        tWorker.setTpassword("a");
        tWorker.setTusername("a");
        tWorker.setTctime(new Date(System.currentTimeMillis()));
        tWorker.setTgtime(new Date(System.currentTimeMillis()));
        return itWorkerDao.insert(tWorker);
    }
}
